{% extends 'base.html' %}

{% block title %}
    惠房网-{{ city }}楼盘-{{ city }}新楼盘  租房|新房|二手房——优质房源
{% endblock %}

{% block styles %}
    {{ super() }}
    <!-- 引入新房列表页样式文件newhouse.css -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/newhouse/newhouse.css') }}">
{% endblock %}

{% block content %}
    {% block newcontent %}
        <!-- 头部区域 -->
        <header class="headers">
            <div class="w">
                <div class="title">
                    <!-- logo模块 -->
                    <a href="{{ url_for('house_bp.newhouse',city=city) }}" class="logo" title="{{ city }}新房楼盘">
                        <img src="{{ url_for('static',filename='images/hz_logo.png') }}" alt="">
                        <span>惠房新房</span>
                    </a>
                    <span class='split'></span>
                    <a href="{{ url_for('house_bp.city') }}" class="s-city">
                        {{ city }}
                    </a>

                    <!-- 区域 -->
                    <ul class="most-area">
                        <li class="first"><a href="javascript:;">热门楼盘：</a></li>
                        {% for data in datas[:5] %}
                            <li><a href="{{ url_for('house_bp.newhouse',city=city) }}?newid={{ data.house_unique }}">{{ data.title }}</a></li>
                        {% endfor %}
                    </ul>
                </div>
                <div class="bottom">
                    <p class="first"><a href="javascript:;">全部楼盘</a></p>
                    <p><a href="javascript:;">近期开盘</a></p>
                    <p><a href="javascript:;">优惠楼盘</a></p>
                    <p><a href="javascript:;">地图找房</a></p>
                    <p><a href="javascript:;">优质新房</a></p>
                </div>
            </div>
        </header>
        <!-- 筛选区域 -->
        <div class="filter w">
            <!-- 城市区域 -->
            <div class="position">
                <div class="post-hd">
                    <span class="wz">位置</span>
                    <div class="area">
                        <a href="javascript:;">
                            区域
                            <span class="arrow1"></span>
                        </a>
                        <a href="javascript:;">
                            地铁线
                            <span class="arrow2"></span>
                        </a>
                    </div>
                </div>
                <div class="post-bd">
                    <ul class="arealist">
                        {% for area in areas %}
                            <li><a href="javascript:;">{{ area.area_name }}</a></li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
        </div>
        <!-- 内容区域 -->
        <div class="content w">
            <!-- 左边数据区域 -->
            <div class="leftcontent">
                <div class="orderFilter">
                    <div class="orderTaa">
                        <ul>
                            <li class="selectoe">
                                <a href="{{ url_for('house_bp.newhouse',city=city) }}">
                                    <h2>默认排序</h2>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;">
                                    <h2>开盘时间</h2>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;">
                                    <h2>楼盘均价</h2>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;">
                                    <h2>新房顾问</h2>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;">
                                    <h2>楼盘特色</h2>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="texttitle">
                    <div class="resultDes">
                        <div class="total">
                            为您找到
                            <span> {{ new_num }} </span>
                            个
                            <a href="javascript:;">{{ city }}楼盘</a>
                        </div>
                    </div>
                </div>
                <div class="datalist">
                    <ul class="datas">
                        {% for new in data_list.items %}
                        <li class="data">
                            <a href="{{ url_for('house_bp.newhouse',city=city) }}?newid={{ new.house_unique }}" class="dataimg">
                                <img src="{{ new.house_img }}" alt="">
                            </a>
                            <div class="info">
                                <div class="title">
                                    <a href="{{ url_for('house_bp.newhouse',city=city) }}?newid={{ new.house_unique }}" class="dataview" title="{{ new.title }}">
                                        {{ new.title }}
                                    </a>
                                    <div class="zs">
                                        <span>在售</span>
                                    </div>
                                    <div class="proper">
                                        <span>{{ new.proper_type }}</span>
                                    </div>
                                </div>
                                <div class="address">
                                    <div class="flood">
                                        <span></span>
                                        <div class="community">
                                            {{ new.area_name }}/{{ new.shop_name }}/{{ new.adress }}
                                        </div>
                                    </div>
                                    {% if new.broker.broker_name %}
                                        <div class="followInfo">
                                            <span></span>
                                            新房顾问：{{ new.broker.broker_name }}
                                        </div>
                                    
                                        <div class="houseInfo">
                                            <span></span>
                                            咨询电话：{{ new.broker.contact }}
                                        </div>
                                    {% endif %}
                                    {% if new.house_feature %}
                                        <div class="ease">
                                            <span></span>
                                            {{ new.house_feature }}
                                        </div>
                                    {% endif %}
                                </div>

                                <div class="priceInfo">
                                    {% if new.unit_price %}
                                        <div class="unitPrice">
                                            <span>{{ new.unit_price }}元/㎡(均价)</span>
                                        </div>
                                    {% else %}
                                        <div class="unitPrice">
                                            <span>价格待定</span>
                                        </div>
                                    {% endif %}
                                    {% if new.total_price %}
                                        <div class="totalPrice">
                                            <span>{{ new.total_price }}万/套(总价)</span>
                                        </div>
                                    {% endif %}
                                </div>
                            </div>
                        </li>
                        {% endfor %}
                    </ul>
                </div>
                <!-- 翻页 -->
                <div class="next-page">
                    <div class="page-left">
                        <span>惠房网 &nbsp;>&nbsp; </span>
                        <span>{{ city }}楼盘 &nbsp;>&nbsp; </span>
                        <span>{{ city }}新房</span>
                    </div>
                    <div class="page-right">
                        <ul>
                            {% if data_list.has_prev %}
                                <li {% if not data_list.has_prev %} class="disabled" {% else %} class="nexts" {% endif %}>
                                    <a href="{{ url_for('house_bp.newhouse',city=city) }}?page={{ data_list.prev_num }}">上一页</a>
                                </li>
                            {% endif %}
                            
                            {% if data_list.pages > 5 %}
                                {% if data_list.page < 5 %}
                                    {% for page_num in range(1,6) %}
                                        <li {% if data_list.page == page_num %} class="pages current" {% endif %}>
                                            <a href="{{ url_for('house_bp.newhouse',city=city) }}?page={{ page_num }}">{{ page_num }}
                                            </a>
                                        </li>
                                    {% endfor %}
                                {% else %}
                                    {% if data_list.next_num %}
                                        {% for page_num in range(data_list.next_num - 4,data_list.next_num + 1) %}
                                            <li {% if data_list.page == page_num %} class="pages current" {% endif %}>
                                                <a href="{{ url_for('house_bp.newhouse',city=city) }}?page={{ page_num }}">{{ page_num }}
                                                </a>
                                            </li>
                                        {% endfor %}
                                    {% else %}
                                        {% for page_num in range(data_list.pages - 4,data_list.pages + 1) %}
                                            <li {% if data_list.page == page_num %} class="pages current" {% endif %}>
                                                <a href="{{ url_for('house_bp.newhouse',city=city) }}?page={{ page_num }}">{{ page_num }}
                                                </a>
                                            </li>
                                        {% endfor %}
                                    {% endif %}

                                {% endif %}
                            {% else %}
                                <!-- 如果总页数小于5执行 -->
                                {% for page_num in range(1,data_list.pages + 1) %}
                                    <li {% if data_list.page == page_num %} class="pages current" {% endif %}>
                                        <a href="{{ url_for('house_bp.newhouse',city=city) }}?page={{ page_num }}">{{ page_num }}
                                        </a>
                                    </li>
                                {% endfor %}
                            {% endif %}
                            
                            {% if data_list.has_next %}
                                <li {% if not data_list.has_next %} class="disabled" {% else %} class="nexts"{% endif %}>
                                    <a href="{{ url_for('house_bp.newhouse',city=city) }}?page={{ data_list.next_num }}">下一页</a>
                                </li>
                            {% endif %}
                        </ul>
                    </div>
                </div>
            </div>
            <!-- 右边广告区域 -->
            <div class="rightcontent">
                <div class="recommend-list">
                    <p>热门楼盘</p>
                    {% for new in datas[:10] %}
                        <div class="recommend-item">
                            <a href="{{ url_for('house_bp.newhouse',city=city) }}?newid={{ new.house_unique }}">
                                <img src="{{ new.house_img }}" alt="{{ new.title }}">
                                <div class="title">
                                    <span class="name">{{ new.title }}</span>
                                    <i class="type">{{ new.proper_type }}</i>
                                    <i class="status">在售</i>
                                </div>
                                <div class="price-wrapper">
                                    {% if new.unit_price %}
                                        <span class="price">{{ new.unit_price }}</span>
                                        <span class="unit">&nbsp;元/平</span>
                                    {% else %}
                                        <span class="price">价格待定</span>
                                    {% endif %}
                                </div>
                            </a>
                        </div>
                    {% endfor %}
                </div>
            </div>>
        </div>
    {% endblock %}
{% endblock %}